package org.loda.test;

import org.junit.Test;
import org.loda.model.Request;
import org.loda.model.Response;
import org.loda.service.FilterChain;

/**
 * 
* @ClassName: MainEntry 
* @Description:demo示例
* @author minjun
*
 */
public class MainEntry {

	@Test
	public void test() {
		//创建过滤器链
		FilterChain chain = new FilterChain()
				.readConfig()//读取配置文件（无参数表示默认配置文件路径为classpath下的filter.xml文件）
//				.readConfig("newFilter.xml")//手动指定配置文件的路径
//				.addFilter(new EncodingFilter())//添加编码过滤
//				.addFilter(new MessageFilter())//添加信息过滤
//				.addFilter(new PermissionFilter())//添加权限过滤
				;
		Request request = new Request().setAttr("begin", "helloword");
		Response response = new Response().setAttr("begin", "helloword");

		// 过滤
		chain.doFilter(request, response);

		System.out.println("处理之后的request:\n" + request);
		System.out.println("处理之后的response:\n" + request);
	}
}
